## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
##
## Implementaion of miscellaneous game functions

import CvUtil
from CvPythonExtensions import *
import CvEventInterface
import CustomFunctions
import ScenarioFunctions

## Opera
import PyHelpers
## END

# globals
cf = CustomFunctions.CustomFunctions()
gc = CyGlobalContext()
sf = ScenarioFunctions.ScenarioFunctions()

class CvGameUtils:
	"Miscellaneous game functions"
	def __init__(self): 
		pass
	
	def isVictoryTest(self):
		if ( gc.getGame().getElapsedGameTurns() > 10 ):
			return True
		else:
			return False

	def isVictory(self, argsList):
		eVictory = argsList[0]
		eTeam = argsList[1]
		if eVictory == gc.getInfoTypeForString('VICTORY_GONE_TO_HELL'):
			return False
		return True

	def isPlayerResearch(self, argsList):
		ePlayer = argsList[0]
		return True

	def getExtraCost(self, argsList):
		ePlayer = argsList[0]
		return 0

	def createBarbarianCities(self):
		return False
		
	def createBarbarianUnits(self):
		return False
		
	def createBarbarianBosses(self, argsList):
		pPlot = argsList[0]
		return False

	def skipResearchPopup(self,argsList):
		ePlayer = argsList[0]
		return False
		
	def showTechChooserButton(self,argsList):
		ePlayer = argsList[0]
		return True

	def getFirstRecommendedTech(self,argsList):
		ePlayer = argsList[0]
		return TechTypes.NO_TECH

	def getSecondRecommendedTech(self,argsList):
		ePlayer = argsList[0]
		eFirstTech = argsList[1]
		return TechTypes.NO_TECH
	
	def canRazeCity(self,argsList):
		iRazingPlayer, pCity = argsList
		return True
	
	def canDeclareWar(self,argsList):
		iAttackingTeam, iDefendingTeam = argsList
		return True
	
	def skipProductionPopup(self,argsList):
		pCity = argsList[0]
		return False
		
	def showExamineCityButton(self,argsList):
		pCity = argsList[0]
		return True

	def getRecommendedUnit(self,argsList):
		pCity = argsList[0]
		return UnitTypes.NO_UNIT

	def getRecommendedBuilding(self,argsList):
		pCity = argsList[0]
		return BuildingTypes.NO_BUILDING

	def updateColoredPlots(self):
		return False

	def isActionRecommended(self,argsList):
		pUnit = argsList[0]
		iAction = argsList[1]
		return False

	def unitCannotMoveInto(self,argsList):
		ePlayer = argsList[0]		
		iUnitId = argsList[1]
		iPlotX = argsList[2]
		iPlotY = argsList[3]
		return False

	def cannotHandleAction(self,argsList):
		pPlot = argsList[0]
		iAction = argsList[1]
		bTestVisible = argsList[2]
		return False

	def canBuild(self,argsList):
		iX, iY, iBuild, iPlayer = argsList

		pPlayer = gc.getPlayer(iPlayer)
		eTeam = gc.getTeam(pPlayer.getTeam())
		pPlot = CyMap().plot(iX, iY)

		if pPlot.getOwner() == iPlayer:
			if pPlot.isCity() == False:
				if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ILLIANS'):
					if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_SNOW'):
						if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_COTTAGE'):
							if (iBuild == gc.getInfoTypeForString("BUILD_COTTAGE")):
								return 1
						if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_WORKSHOP'):
							if (iBuild == gc.getInfoTypeForString("BUILD_WORKSHOP")):
								return 1

				if (iBuild == gc.getInfoTypeForString("BUILD_WORKSHOP")):
					if pPlot.getImprovementType() != gc.getInfoTypeForString('IMPROVEMENT_WORKSHOP'):
						if pPlayer.isHasTech(gc.getInfoTypeForString('TECH_MACHINERY')) == True:
							if (pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_PLAINS') or pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_TUNDRA') or pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_FIELDS_OF_PERDITION')):
								return 1

		if (iBuild == gc.getInfoTypeForString("BUILD_FISHING_VILLAGE")):
			if pPlot.isAdjacentToLand() == False:
				return 0
			for iiX in range(iX-2, iX+3, 1):
				for iiY in range(iY-2, iY+3, 1):
					p2Plot = CyMap().plot(iiX,iiY)
					if not p2Plot.isNone():
						iImprovement = p2Plot.getImprovementType()
						if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_FISHING_VILLAGE'):
							return 0
						if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_SMUGGLERS_COVE'):
							return 0
						if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_PIRATE_PORT'):
							return 0
				
###############
###Turintur.###
###    AI   ###
###############
		if pPlayer.isHuman() == False:	
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_CONSTRUCTION')) == True :
				if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_GOVERNMENT')) == gc.getInfoTypeForString('CIVIC_ARISTOCRACY'):
					if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_ECONOMY')) == gc.getInfoTypeForString('CIVIC_AGRARIANISM'):
						if iBuild == gc.getInfoTypeForString('BUILD_COTTAGE'):
							return 0
						if iBuild == gc.getInfoTypeForString('BUILD_LUMBERMILL'):
							return 0
						
		if pPlayer.isHuman() == False:	
			if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_RELIGION')) == gc.getInfoTypeForString('CIVIC_ARETE'):
				if iBuild == gc.getInfoTypeForString('BUILD_WINDMILL'):
					return 0
				
		if pPlayer.isHuman() == False:
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_GUILDS')) == False :
				if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_FALLOW')) == False:	
					if iBuild == gc.getInfoTypeForString('BUILD_WORKSHOP'):
						return 0
###############
###  end of ###
### addition###
###############
		
		return -1	# Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it can

	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlot = CyMap().plot(iPlotX,iPlotY)
# scions start
		pPlayer = gc.getPlayer(iPlayer)
		
		if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_SETTLERS):
			if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SCIONS'):
				if pPlayer.getNumCities() > 0:
					return true
# scions end
		return False

	def cannotSelectionListMove(self,argsList):
		pPlot = argsList[0]
		bAlt = argsList[1]
		bShift = argsList[2]
		bCtrl = argsList[3]
		return False

	def cannotSelectionListGameNetMessage(self,argsList):
		eMessage = argsList[0]
		iData2 = argsList[1]
		iData3 = argsList[2]
		iData4 = argsList[3]
		iFlags = argsList[4]
		bAlt = argsList[5]
		bShift = argsList[6]
		return False

	def cannotDoControl(self,argsList):
		eControl = argsList[0]
		return False

	def canResearch(self,argsList):
		ePlayer = argsList[0]
		eTech = argsList[1]
		bTrade = argsList[2]
		return False

	def cannotResearch(self,argsList):
		ePlayer = argsList[0]
		eTech = argsList[1]
		bTrade = argsList[2]
		pPlayer = gc.getPlayer(ePlayer)
		eTeam = gc.getTeam(pPlayer.getTeam())

		if eTech == gc.getInfoTypeForString('TECH_ORDERS_FROM_HEAVEN'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_6):
				return True
			if pPlayer.isAgnostic() or pPlayer.isIntolerant() or pPlayer.isUniqueCult():
				return True
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
					return True
		if eTech == gc.getInfoTypeForString('TECH_WAY_OF_THE_EARTHMOTHER'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_4):
				return True
			if pPlayer.isAgnostic() or pPlayer.isIntolerant() or pPlayer.isUniqueCult():
				return True
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
					return True
		if eTech == gc.getInfoTypeForString('TECH_WAY_OF_THE_FORESTS'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_3):
				return True
			if pPlayer.isAgnostic() or pPlayer.isIntolerant() or pPlayer.isUniqueCult():
				return True
		if eTech == gc.getInfoTypeForString('TECH_MESSAGE_FROM_THE_DEEP'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_1):
				return True
			if pPlayer.isAgnostic() or pPlayer.isIntolerant() or pPlayer.isUniqueCult():
				return True
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
					return True
		if eTech == gc.getInfoTypeForString('TECH_CORRUPTION_OF_SPIRIT'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_0):
				return True
			if pPlayer.isAgnostic() or pPlayer.isIntolerant() or pPlayer.isUniqueCult():
				return True
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
					return True
		if eTech == gc.getInfoTypeForString('TECH_WAY_OF_THE_WISE'):
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
					return True
		if eTech == gc.getInfoTypeForString('TECH_WAY_OF_THE_WICKED'):
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
					return True
		if eTech == gc.getInfoTypeForString('TECH_HONOR'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_5):
				return True
			if pPlayer.isAgnostic() or pPlayer.isIntolerant() or pPlayer.isUniqueCult():
				return True
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
					return True
		if eTech == gc.getInfoTypeForString('TECH_DECEPTION'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_2):
				return True
			if pPlayer.isAgnostic() or pPlayer.isIntolerant() or pPlayer.isUniqueCult():
				return True
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
					return True
#Orbi Lizstart
		if eTech == gc.getInfoTypeForString('TECH_JUNGLEDWELLING'):
				return True
		if eTech == gc.getInfoTypeForString('TECH_THE_GIFT'):
				return True
		if eTech == gc.getInfoTypeForString('TECH_STEAM_POWER'):
			if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_MECHANOS'):
				return True

#Orbi Lizend
		if CyGame().getWBMapScript():
			bBlock = sf.cannotResearch(ePlayer, eTech, bTrade)
			if bBlock:
				return True

		return False

	def canDoCivic(self,argsList):
		ePlayer = argsList[0]
		eCivic = argsList[1]
		return False

	def cannotDoCivic(self,argsList):
		ePlayer = argsList[0]
		eCivic = argsList[1]
		pPlayer = gc.getPlayer(ePlayer)
		eTeam = gc.getTeam(pPlayer.getTeam())

# ngomele start
		if gc.getPlayer(ePlayer).getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_NGOMELE'):
			if gc.getCivicInfo(eCivic).getCivicOptionType() == gc.getInfoTypeForString('CIVICOPTION_ECONOMY'):
				if eCivic != gc.getInfoTypeForString('CIVIC_GNOLL_TRIBES'):
					if eCivic != gc.getInfoTypeForString('CIVIC_GNOLL_COUNCIL'):
						return True
# ngomele end
			
		return False
		
	def canTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
		return False

	def cannotTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
		ePlayer = pCity.getOwner()
		pPlayer = gc.getPlayer(ePlayer)
		eUnitClass = gc.getUnitInfo(eUnit).getUnitClassType()
		eTeam = gc.getTeam(pPlayer.getTeam())

		if pPlayer.isHuman() == False and bContinue == False:
			infoCiv = gc.getCivilizationInfo(pPlayer.getCivilizationType())
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_WARRIOR'):
				pPlot = pCity.plot()
### AI Change; Opera from Turinturambar
				""" ### Original Code ###
				if pPlot.getNumUnits() >= 2:
				"""
				if pPlot.getNumUnits() >= 3:
					iTrainingYard = infoCiv.getCivilizationBuildings(gc.getInfoTypeForString('BUILDINGCLASS_TRAINING_YARD'))
					if iTrainingYard != -1:
						if pPlayer.canConstruct(iTrainingYard, False, False, False):
							### Addition
							if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_SHEAIM'):
							### End
								return True
				### End
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_SCOUT'):
### AI Change; Opera from Turinturambar
				""" ### Original Code ###
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_SCOUT')) > 3:
				"""
				if pPlayer.getUnitClassCountPlusMaking(gc.getInfoTypeForString('UNITCLASS_SCOUT')) >= 1:
### End
					return True
				iHuntingLodge = infoCiv.getCivilizationBuildings(gc.getInfoTypeForString('BUILDINGCLASS_HUNTING_LODGE'))
				if iHuntingLodge != -1:
					if pPlayer.canConstruct(iHuntingLodge, False, False, False):
						return True
			if eUnit == gc.getInfoTypeForString('UNIT_DEMAGOG'):
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_DEMAGOG')) > 6:
					return True
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_SETTLER'):
				if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_KHAZAD'):
					if pPlayer.getGold() / pPlayer.getNumCities() <= 149:
						return True
				
				### AI Change; Opera (created with Turinturambar and Iceciro code)
				if eTeam.isHasTech(gc.getInfoTypeForString('TECH_TRADE')) == False:
					if pPlayer.getUnitClassCountPlusMaking(eUnitClass) > 0:
						return True
				else:
					if pPlayer.getNumCities() <= 7:
						if pPlayer.getUnitClassCountPlusMaking(eUnitClass) > 1:
							return True
					else:
						if pPlayer.getUnitClassCountPlusMaking(eUnitClass) > 2:
							return True
				### End
				
				if pCity.getPopulation() < 4:
					return True
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_WORKER'):
				if pPlayer.getCurrentEra() == gc.getInfoTypeForString('ERA_ANCIENT'):
					### AI Change; Opera from Turinturambar
					""" ### Original Code ###
					if pPlayer.getUnitClassCountPlusMaking(gc.getInfoTypeForString('UNITCLASS_WORKER')) > 1:
					"""
					if 2 * pPlayer.getNumCities() <= pPlayer.getUnitClassCountPlusMaking(gc.getInfoTypeForString('UNITCLASS_WORKER')) :
						return True
					### End
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_ADEPT'):
				#increase Adepts from 4 to 10 Notque 03/21/09
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_ADEPT')) > 10:
					return True
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_DISCIPLE_EMPYREAN'):
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_DISCIPLE_EMPYREAN')) > 3:
					return True
				### AI Change; Opera (from Turin)
				if not pPlayer.hasHolyCity(gc.getInfoTypeForString('RELIGION_THE_EMPYREAN')):
					if not pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MALAKIM'):
						return True
				### End
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_DISCIPLE_FELLOWSHIP_OF_LEAVES'):
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_DISCIPLE_FELLOWSHIP_OF_LEAVES')) > 3:
					return True
				### AI Change; Opera (from Turin)
				if not pPlayer.hasHolyCity(gc.getInfoTypeForString('RELIGION_FELLOWSHIP_OF_LEAVES')):
					if not pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR'):
							return True
				### End
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_DISCIPLE_OCTOPUS_OVERLORDS'):
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_DISCIPLE_OCTOPUS_OVERLORDS')) > 3:
					return True
				### AI Change; Opera (from Turin)
				if not pPlayer.hasHolyCity(gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS')):
					if not pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LANUN'):
						return True
				### End
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_DISCIPLE_RUNES_OF_KILMORPH'):
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_DISCIPLE_RUNES_OF_KILMORPH')) > 3:
					return True
				### AI Change; Opera (from Turin)
				if not pPlayer.hasHolyCity(gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH')):
					if not pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_KHAZAD'):
						return True
				### End
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_DISCIPLE_THE_ASHEN_VEIL'):
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_DISCIPLE_THE_ASHEN_VEIL')) > 3:
					return True
				### AI Change; Opera (from Turin)
				if not pPlayer.hasHolyCity(gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL')):
					if not pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SHEAIM'):
						return True
				### End
			if eUnitClass == gc.getInfoTypeForString('UNITCLASS_DISCIPLE_THE_ORDER'):
				if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_DISCIPLE_THE_ORDER')) > 3:
					return True
				### AI Change; Opera (from Turin)
				if not pPlayer.hasHolyCity(gc.getInfoTypeForString('RELIGION_THE_ORDER')):
					if not pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_BANNOR'):
						return True
				### End

#---Orbis addition start-----------------------
		if eUnitClass == gc.getInfoTypeForString('UNITCLASS_DRUID'):
			if (pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL') or pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ORDER')):
				return True

		if eUnit == gc.getInfoTypeForString('UNIT_SHADOW_PRIEST_OF_AGRUONN'):
			if CyGame().isUnitClassMaxedOut(gc.getInfoTypeForString('UNITCLASS_MIQUIZTLI'), 0) == False:
				return True
#---Orbis addition end-----------------------

		if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_CULTURAL_VALUES')) == gc.getInfoTypeForString('CIVIC_CRUSADE'):
			if eUnit == gc.getInfoTypeForString('UNIT_WORKER'):
				return True
			if eUnit == gc.getInfoTypeForString('UNIT_SETTLER'):
				return True
			if eUnit == gc.getInfoTypeForString('UNIT_WORKBOAT'):
				return True

		if eUnit == gc.getInfoTypeForString('UNIT_ACHERON'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_ACHERON):
				return True

		if eUnit == gc.getInfoTypeForString('UNIT_DUIN'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_DUIN):
				return True

		if eUnit == gc.getInfoTypeForString('UNIT_BEAST_OF_AGARES'):
			if pCity.getPopulation() <= 5:
				return True

		### AI Change; Opera from Turinturambar
		if pPlayer.isHuman() == False:
			if eUnitClass != gc.getInfoTypeForString('UNITCLASS_WARRIOR'):
					if pPlayer.getUnitClassCountPlusMaking(gc.getInfoTypeForString('UNITCLASS_WARRIOR')) <= 2:
						if not eTeam.isHasTech(gc.getInfoTypeForString('TECH_BRONZE_WORKING')): 
							if not eTeam.isHasTech(gc.getInfoTypeForString('TECH_ARCHERY')):
								return True
		### End
		
		if CyGame().getWBMapScript():
			bBlock = sf.cannotTrain(pCity, eUnit, bContinue, bTestVisible, bIgnoreCost, bIgnoreUpgrades)
			if bBlock:
				return True

		return False

	def canConstruct(self,argsList):
		pCity = argsList[0]
		eBuilding = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		pPlayer = gc.getPlayer(pCity.getOwner())

		if eBuilding == gc.getInfoTypeForString('BUILDING_SACRIFICAL_ALTAR'):
			if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MAZATL'):
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
					if pPlayer.isHasTech(gc.getInfoTypeForString('TECH_MYSTICISM')) == True:
						if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_SACRIFICAL_ALTAR')) == 0:
							return True

		return False

	def cannotConstruct(self,argsList):
		pCity = argsList[0]
		eBuilding = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		pPlayer = gc.getPlayer(pCity.getOwner())
		iBuildingClass = gc.getBuildingInfo(eBuilding).getBuildingClassType()
		eTeam = gc.getTeam(pPlayer.getTeam())

#---Orbi addition-----------------------
		if eBuilding == gc.getInfoTypeForString('BUILDING_PALISADE'):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_WALLS')) > 0:
				return True
		if eBuilding == gc.getInfoTypeForString('BUILDING_CASTRA_LEGIONIS'):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_WILD_HAVEN')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_KNIGHTLY_ORDER')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ENGINEERING_CORPS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_NAVAL_ACADEMY')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ARROW_TOWER')) > 0:
				return True
		if eBuilding == gc.getInfoTypeForString('BUILDING_KNIGHTLY_ORDER'):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_WILD_HAVEN')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_CASTRA_LEGIONIS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ENGINEERING_CORPS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_NAVAL_ACADEMY')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ARROW_TOWER')) > 0:
				return True
		if eBuilding == gc.getInfoTypeForString('BUILDING_ENGINEERING_CORPS'):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_WILD_HAVEN')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_KNIGHTLY_ORDER')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_CASTRA_LEGIONIS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_NAVAL_ACADEMY')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ARROW_TOWER')) > 0:
				return True
		if eBuilding == gc.getInfoTypeForString('BUILDING_NAVAL_ACADEMY'):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_WILD_HAVEN')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_KNIGHTLY_ORDER')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ENGINEERING_CORPS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_CASTRA_LEGIONIS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ARROW_TOWER')) > 0:
				return True
		if eBuilding == gc.getInfoTypeForString('BUILDING_ARROW_TOWER'):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_WILD_HAVEN')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_KNIGHTLY_ORDER')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ENGINEERING_CORPS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_CASTRA_LEGIONIS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_NAVAL_ACADEMY')) > 0:
				return True
		if eBuilding == gc.getInfoTypeForString('BUILDING_WILD_HAVEN'):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_CASTRA_LEGIONIS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_KNIGHTLY_ORDER')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ENGINEERING_CORPS')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_NAVAL_ACADEMY')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ARROW_TOWER')) > 0:
				return True
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_DANCING_BEAR')) > 0:
				return False
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_WOLF_PEN')) > 0:
				return False
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_TIGER_CAGE')) > 0:
				return False
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_LION_CAGE')) > 0:
				return False
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_GORILLA_CAGE')) > 0:
				return False
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_SPIDER_PEN')) > 0:
				return False
			return True

		if eBuilding == gc.getInfoTypeForString('BUILDING_SACELLUM_OF_KALSHEKK'):
			if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
				return True
		if eBuilding == gc.getInfoTypeForString('BUILDING_MONASTERY_OF_OMORR'):
			if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
				return True
#---Orbi addition end-----------------------

		if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_CULTURAL_VALUES')) == gc.getInfoTypeForString('CIVIC_CRUSADE'):
			if eBuilding == gc.getInfoTypeForString('BUILDING_ELDER_COUNCIL'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_MARKET'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_MONUMENT'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_MONEYCHANGER'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_THEATRE'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_AQUEDUCT'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_PUBLIC_BATHS'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_HERBALIST'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_CARNIVAL'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_COURTHOUSE'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_GAMBLING_HOUSE'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_GRANARY'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_SMOKEHOUSE'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_LIBRARY'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_HARBOR'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_ALCHEMY_LAB'):
				return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_BREWERY'):
				return True

		if eBuilding == gc.getInfoTypeForString('BUILDING_SHRINE_OF_THE_CHAMPION'):
			iHero = cf.getHero(pPlayer)
			if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_KORRINA_BLACK')) > 0:
				return True
			if pPlayer.getUnitClassCount(gc.getInfoTypeForString('UNITCLASS_KORRINA_RED')) > 0:
				return True
			if iHero == -1:
				return True
			if CyGame().isUnitClassMaxedOut(iHero, 0) == False:
				return True
			if pPlayer.getUnitClassCount(iHero) > 0:
				return True

		if eBuilding == gc.getInfoTypeForString('BUILDING_MERCURIAN_GATE'):
			if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_HYBOREM_OR_BASIUM):
				return True
			if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
				return True
			if pCity.isCapital() and not pCity.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MERCURIANS'):
				return True
			if pPlayer.isHuman() == False:
				if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
					return True

		iAltar1 = gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR')
		iAltar2 = gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR_ANOINTED')
		iAltar3 = gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR_BLESSED')
		iAltar4 = gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR_CONSECRATED')
		iAltar5 = gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR_DIVINE')
		iAltar6 = gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR_EXALTED')
		iAltar7 = gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR_FINAL')
		if (eBuilding == iAltar1 or eBuilding == iAltar2 or eBuilding == iAltar3 or eBuilding == iAltar4 or eBuilding == iAltar5 or eBuilding == iAltar6 or eBuilding == iAltar7):
			if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
				return True
			if eBuilding == iAltar1:
				if (pPlayer.countNumBuildings(iAltar2) > 0 or pPlayer.countNumBuildings(iAltar3) > 0 or pPlayer.countNumBuildings(iAltar4) > 0 or pPlayer.countNumBuildings(iAltar5) > 0 or pPlayer.countNumBuildings(iAltar6) > 0 or pPlayer.countNumBuildings(iAltar7) > 0):
					return True
			if eBuilding == iAltar2:
				if (pPlayer.countNumBuildings(iAltar3) > 0 or pPlayer.countNumBuildings(iAltar4) > 0 or pPlayer.countNumBuildings(iAltar5) > 0 or pPlayer.countNumBuildings(iAltar6) > 0 or pPlayer.countNumBuildings(iAltar7) > 0):
					return True
			if eBuilding == iAltar3:
				if (pPlayer.countNumBuildings(iAltar4) > 0 or pPlayer.countNumBuildings(iAltar5) > 0 or pPlayer.countNumBuildings(iAltar6) > 0 or pPlayer.countNumBuildings(iAltar7) > 0):
					return True
			if eBuilding == iAltar4:
				if (pPlayer.countNumBuildings(iAltar5) > 0 or pPlayer.countNumBuildings(iAltar6) > 0 or pPlayer.countNumBuildings(iAltar7) > 0):
					return True
			if eBuilding == iAltar5:
				if (pPlayer.countNumBuildings(iAltar6) > 0 or pPlayer.countNumBuildings(iAltar7) > 0):
					return True
			if eBuilding == iAltar6:
				if pPlayer.countNumBuildings(iAltar7) > 0:
					return True

		if pPlayer.isHuman() == False:
			if eBuilding == gc.getInfoTypeForString('BUILDING_PROPHECY_OF_RAGNAROK'):
				if pPlayer.getAlignment() != gc.getInfoTypeForString('ALIGNMENT_EVIL'):
					return True

		if eBuilding == gc.getInfoTypeForString('BUILDING_SMUGGLERS_PORT'):
			if pPlayer.isSmugglingRing() == False:
				return True
		
		##AI Change; Opera from Turinturambar
		if pPlayer.isHuman() == False :
			if eBuilding == gc.getInfoTypeForString('BUILDING_MONUMENT'):
				if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_CREATIVE')) and pCity.getPopulation <=5:
					return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_MONEYCHANGER'):
				if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_FINANCIAL')) and pCity.getPopulation <=5:
					return True
				if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_FINANCIAL')) == False: 
					if pCity.getPopulation() <=8:
						return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_TAX_OFFICE'):
				if pCity.getPopulation() <=12:
					if pCity.angryPopulation >=0:
						return True			
			if eBuilding == gc.getInfoTypeForString('BUILDING_THEATRE'):
				if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_CREATIVE')) and pCity.getPopulation <=6:
					return True
				if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_CREATIVE')) == False: 
					if pCity.getPopulation() <=12:
						return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_AQUEDUCT'):
				if pCity.badHealth(False)-pCity.goodHealth() < -1 :
					return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_PUBLIC_BATHS'):
				if pCity.angryPopulation <=-1:
					return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_HERBALIST'):
				if pCity.badHealth(False)-pCity.goodHealth() < -1 :
					return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_CARNIVAL'):
				if not pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_CREATIVE')) :
					if pCity.angryPopulation <=-1:
						return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_GRANARY'):
				if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_EXPANSIVE')) == False:
					if pCity.badHealth(False)-pCity.goodHealth() < -1 :
						return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_BREEDING_PIT'):
				if pCity.getPopulation() <=8:
					return True		
			if eBuilding == gc.getInfoTypeForString('BUILDING_RELIQUARY'):
				if pCity.getPopulation() <=8:
					return True				
			if eBuilding == gc.getInfoTypeForString('BUILDING_SMOKEHOUSE'):
				if pCity.badHealth(False)-pCity.goodHealth() < -1 :
					return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_INFIRMARY'):
				if pCity.badHealth(False)-pCity.goodHealth() < 1 :
					return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_INN'):
				if pCity.getPopulation() <=10:
					return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_TAVERN'):
				if pCity.getPopulation() <=15:
					return True
			if eBuilding == gc.getInfoTypeForString('BUILDING_ALCHEMY_LAB'):
				if pCity.getPopulation() <=10:
					return True	
			if eBuilding == gc.getInfoTypeForString('BUILDING_CITY_OF_A_THOUSAND_SLUMS'):
				if pCity.getPopulation() <=20:
					return True			
			if 	eBuilding == gc.getInfoTypeForString('BUILDING_ARCHERY_RANGE'):	
				if pPlayer.getNumCities() >= 3:
					if pPlayer.getBuildingClassCountPlusMaking(gc.getInfoTypeForString('BUILDINGCLASS_ARCHERY_RANGE')) * 3 >  pPlayer.getNumCities():
						if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR'):
							return True
			if 	eBuilding == gc.getInfoTypeForString('BUILDING_STABLE'):	
				if pPlayer.getNumCities() >= 3:
					if pPlayer.getBuildingClassCountPlusMaking(gc.getInfoTypeForString('BUILDINGCLASS_STABLE')) * 3 > pPlayer.getNumCities():
						if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_HIPPUS'):
							return True			
			if 	eBuilding == gc.getInfoTypeForString('BUILDING_HUNTING_LODGE'):	
				if pPlayer.getNumCities() >= 3:
					if pPlayer.getBuildingClassCountPlusMaking(gc.getInfoTypeForString('BUILDINGCLASS_HUNTING_LODGE')) * 3 >  pPlayer.getNumCities():
						if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR'):
							return True				
			if pPlayer.getUnitClassCountPlusMaking(gc.getInfoTypeForString('UNITCLASS_WARRIOR')) <= 2:
				if not eTeam.isHasTech(gc.getInfoTypeForString('TECH_BRONZE_WORKING')): 
					if not eTeam.isHasTech(gc.getInfoTypeForString('TECH_ARCHERY')):
						return True			
			if isWorldWonderClass(iBuildingClass):
				if pCity.getPopulation() <=7 and pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_ORC'):
					return True
			##End

		return False

	def canCreate(self,argsList):
		pCity = argsList[0]
		eProject = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		return False

	def cannotCreate(self,argsList):
		pCity = argsList[0]
		eProject = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		pPlayer = gc.getPlayer(pCity.getOwner())
		eTeam = gc.getTeam(pPlayer.getTeam())

		if eProject == gc.getInfoTypeForString('PROJECT_PURGE_THE_UNFAITHFUL'):
			### AI Change; Opera from Turinturambar
			if not pPlayer.isHuman():
				return True
			### End
			if pPlayer.getStateReligion() == -1:
				return True

		if eProject == gc.getInfoTypeForString('PROJECT_BIRTHRIGHT_REGAINED'):
			if not pPlayer.isFeatAccomplished(FeatTypes.FEAT_GLOBAL_SPELL):
				return True

		if eProject == gc.getInfoTypeForString('PROJECT_STIR_FROM_SLUMBER'):
			if pPlayer.getPlayersKilled() == 0:
				return True

		if eProject == gc.getInfoTypeForString('PROJECT_GENESIS'):
			if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ILLIANS'):
				return True
			
		### AI Change; Opera from Turinturambar
		if eProject == gc.getInfoTypeForString('PROJECT_SAMHAIN'):
			if pPlayer.getNumCities() <= 3:
				return True
		
		if not pPlayer.isHuman():
			if eProject != gc.getInfoTypeForString('PROJECT_SAMHAIN'):
				if pPlayer.getNumCities() <= 7:
					return True
				if pPlayer.getUnitClassCountPlusMaking(gc.getInfoTypeForString('UNITCLASS_WARRIOR')) <= 2:
					if not eTeam.isHasTech(gc.getInfoTypeForString('TECH_BRONZE_WORKING')):
						if not eTeam.isHasTech(gc.getInfoTypeForString('TECH_ARCHERY')):
							if not eTeam.isHasTech(gc.getInfoTypeForString('TECH_HUNTING')):
								return True
		### End

		return False

	def canMaintain(self,argsList):
		pCity = argsList[0]
		eProcess = argsList[1]
		bContinue = argsList[2]
		return False

	def cannotMaintain(self,argsList):
		pCity = argsList[0]
		eProcess = argsList[1]
		bContinue = argsList[2]
		return False

	def AI_chooseTech(self,argsList):
		ePlayer = argsList[0]
		bFree = argsList[1]
		pPlayer = gc.getPlayer(ePlayer)
		pCity = pPlayer.getCapitalCity()
		eTeam = gc.getTeam(pPlayer.getTeam())
		iTech = -1
		
		### AI Change: Choosing Tech; Opera (from Turin) ###
		####-----###
		### Added some checks to force the AI to research crucial techs;
		### Below-er checks overwrite above-er ones.
		### Civ/Leaders beelines are placed below. However, I tried not to broke the AI with flavorful beelines.
		####-----###
		
		####-----###
		## Religion beelines
		####-----###
		
		iLeader = gc.getLeaderHeadInfo(pPlayer.getLeaderType())
		CvUtil.pyPrint('Start religion beelines for %s on turn %d'
			       %(iLeader.getDescription(), CyGame().getGameTurn()))
		iFlavor = iLeader.getFlavorValue(gc.getInfoTypeForString('FLAVOR_RELIGION'))
		CvUtil.pyPrint("Flavor is %d"
			       %(iFlavor))
		iFoL = gc.getInfoTypeForString('RELIGION_FELLOWSHIP_OF_LEAVES')
		iRoK = gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH')
		iOO = gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS')
		iOrd = gc.getInfoTypeForString('RELIGION_THE_ORDER')
		iAV = gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL')
		iEmpy = gc.getInfoTypeForString('RELIGION_THE_EMPYREAN')
		iCoE = gc.getInfoTypeForString('RELIGION_COUNCIL_OF_ESUS')
		
		iBestValue = 0
		iBestReligion = -1
		
		bFoLFounded = False
		bRoKFounded = False
		bOOFounded = False
		bOrdFounded = False
		bAVFounded = False
		bEmpyFounded = False
		bCoEFounded = False
		
		## Beelines for special techs
		
		if not pPlayer.isAgnostic() \
		or not pPlayer.isIntolerant() \
		or not pPlayer.isUniqueCult():
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_CORRUPTION_OF_SPIRIT')) \
			and not eTeam.isHasTech(gc.getInfoTypeForString('TECH_INFERNAL_PACT')) \
			and pPlayer.getNumCities() >= 4:
				if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
					if pPlayer.hasHolyCity(pPlayer.getStateReligion()) == True :
						iValue = 100
					else:
						iValue = 66
					if CyGame().getSorenRandNum(100, "Infernal pact") <= iValue:
						iTech = gc.getInfoTypeForString('TECH_INFERNAL_PACT')
			
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_WAY_OF_THE_EARTHMOTHER')) \
			and not eTeam.isHasTech(gc.getInfoTypeForString('TECH_ARETE')):
				if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH'):
					iTech = gc.getInfoTypeForString('TECH_ARETE')
			
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MESSAGE_FROM_THE_DEEP')) \
			and not eTeam.isHasTech(gc.getInfoTypeForString('TECH_MIND_STAPLING')):
				if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS'):
					iTech = gc.getInfoTypeForString('TECH_MIND_STAPLING')
			
			## Check if is founded
			for iTeam2 in range(gc.getMAX_TEAMS()):
				eTeam2 = gc.getTeam(iTeam2)
				if eTeam2.isAlive():
					if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_WAY_OF_THE_FORESTS')):
						if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_3):
							bFoLFounded = True
							CvUtil.pyPrint('FoL founded')
					if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_WAY_OF_THE_EARTHMOTHER')):
						if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_4):
							bRoKFounded = True
							CvUtil.pyPrint('RoK founded')
					if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_MESSAGE_FROM_THE_DEEP')):
						if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_1):
							bOOFounded = True
							CvUtil.pyPrint('OO founded')
					if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_ORDERS_FROM_HEAVEN')):
						if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_6):
							bOrdFounded = True
							CvUtil.pyPrint('The Order founded')
					if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_CORRUPTION_OF_SPIRIT')):
						if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_0):
							bAVFounded = True
							CvUtil.pyPrint('AV founded')
					if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_HONOR')):
						if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_5):
							bEmpyFounded = True
							CvUtil.pyPrint('Empy founded')
					if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_DECEPTION')):
						if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_2):
							bCoEFounded = True
							CvUtil.pyPrint('CoE founded')
							
			## Get # holy cities and excluding CotD
			CvUtil.pyPrint('Get Holy Cities...')
			if pPlayer.countHolyCities() > 0:
				if pPlayer.hasHolyCity(gc.getInfoTypeForString('RELIGION_CULT_OF_THE_DRAGON')):
					iHolyCity = pPlayer.countHolyCities() - 1
					CvUtil.pyPrint('... has the CotD HC! This city is excluded from the count, which is %d...'
						       %(iHolyCity))
				else:
					iHolyCity = pPlayer.countHolyCities()
					CvUtil.pyPrint('... has %d holy city...'
						       %(iHolyCity))
			else:
				iHolyCity = 0
				CvUtil.pyPrint('... do not have any holy city!')
			
			## FoL
			CvUtil.pyPrint('Checking FoL eligibility...')
			if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_3):
				if iLeader.getReligionWeightModifier(iFoL) >= 0:
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MYSTICISM')) \
					or eTeam.isHasTech(gc.getInfoTypeForString('TECH_TRACKING')) \
					and pPlayer.getNumCities() >= 3:
						if not iHolyCity > 0 \
						or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR') \
						or iLeader == gc.getInfoTypeForString('LEADER_HATHEIM'):
							CvUtil.pyPrint('%s eligible for FoL'
								       %(iLeader.getDescription()))
							iDiceFoL = CyGame().getSorenRandNum(100, "FoL")
							CvUtil.pyPrint('DiceFoL is %d'
								       %(iDiceFoL))
							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR'):
								iDiceFoL += 30
								CvUtil.pyPrint('Civ is Ljos, Dice is now %d'
									       %(iDiceFoL))
							if iLeader.getFavoriteReligion() == iFoL:
								iDiceFoL += 30
								CvUtil.pyPrint('Leader has FoL as FavRel, Dice is now %d'
									       %(iDiceFoL))
							#if iFlavor != 0:
							#	iDiceFoL += iFlavor
							#	CvUtil.pyPrint('Leader has a flavor, Dice is now %d'
							#		       %(iDiceFoL))
							if bFoLFounded:
								iDiceFoL -= 50
								CvUtil.pyPrint('FoL is founded already, Dice is now %d'
									       %(iDiceFoL))
							if iDiceFoL >= 0 \
							and iDiceFoL >= 100-iLeader.getReligionWeightModifier(iFoL):
								iFoLValue = iDiceFoL - (100-iLeader.getReligionWeightModifier(iFoL))
								CvUtil.pyPrint('Dice was good, FoL Value is %d'
									       %(iFoLValue))
								if iFoLValue > iBestValue:
									iBestValue = iFoLValue
									iBestReligion = iFoL
									CvUtil.pyPrint('FoLValue is Best!')
								else:
									CvUtil.pyPrint('FoLValue rejected!')
							else:
								CvUtil.pyPrint('FoL rejected!')
						else:
							CvUtil.pyPrint('... %s has already a Holy City!'
								       %(iLeader.getDescription()))
					else:
						CvUtil.pyPrint('... rejected! (no mysticism, no tracking, not >= 3 cities, Agnostic)')
				else:
					CvUtil.pyPrint('... rejected because leader doesn\'t like FoL!')
			else:
				CvUtil.pyPrint('... no FoL in this game!')
						
			## RoK
			CvUtil.pyPrint('Checking RoK eligibility...')
			if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_4):
				if iLeader.getReligionWeightModifier(iRoK) >= 0:
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MYSTICISM')) \
					or eTeam.isHasTech(gc.getInfoTypeForString('TECH_MINING')) \
					and pPlayer.getNumCities() >= 3 \
					and not pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
						if not iHolyCity > 0 \
						or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_KHAZAD'):
							CvUtil.pyPrint('%s eligible for RoK'
								       %(iLeader.getDescription()))
							iDiceRoK = CyGame().getSorenRandNum(100, "RoK")
							CvUtil.pyPrint('DiceRoK is %d'
								       %(iDiceRoK))
							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_KHAZAD'):
								iDiceRoK += 30
								CvUtil.pyPrint('Civ is Khazad, Dice is now %d'
									       %(iDiceRoK))
							if iLeader.getFavoriteReligion() == iRoK:
								iDiceRoK += 30
								CvUtil.pyPrint('Leader has RoK as FavRel, Dice is now %d'
									       %(iDiceRoK))
							#if iFlavor != 0:
							#	iDiceRoK += iFlavor
							if bRoKFounded:
								iDiceRoK -= 50
								CvUtil.pyPrint('RoK is already founded, Dice is now %d'
									       %(iDiceRoK))
							if iDiceRoK >= 0 \
							and iDiceRoK >= 100-iLeader.getReligionWeightModifier(iRoK):
								iRoKValue = iDiceRoK - (100-iLeader.getReligionWeightModifier(iRoK))
								CvUtil.pyPrint('Dice was good, RoK Value is %d'
									       %(iRoKValue))
								if iRoKValue > iBestValue:
									iBestValue = iRoKValue
									iBestReligion = iRoK
									CvUtil.pyPrint('RoKValue is Best!')
								else:
									CvUtil.pyPrint('RoKValue rejected!')
							else:
								CvUtil.pyPrint('RoK rejected!')
						else:
							CvUtil.pyPrint('... %s has already a Holy City!'
								       %(iLeader.getDescription()))
					else:
						CvUtil.pyPrint('... rejected (no mysticism, no mining, not >= 3 cities, Agnostic, Evil)!')
				else:
					CvUtil.pyPrint('... rejected because leader doesn\'t like RoK!')
			else:
				CvUtil.pyPrint('... no RoK in this game!')
						
			## OO
			CvUtil.pyPrint('Checking OO eligibility...')
			if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_1):
				if iLeader.getReligionWeightModifier(iOO) >= 0:
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MYSTICISM')) \
					or eTeam.isHasTech(gc.getInfoTypeForString('TECH_SAILING')) \
					and pPlayer.getNumCities() >= 3 \
					and not pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
						if not iHolyCity > 0 \
						or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LANUN'):
							CvUtil.pyPrint('%s eligible for OO'
								       %(iLeader.getDescription()))
							iDiceOO = CyGame().getSorenRandNum(100, "OO")
							CvUtil.pyPrint('DiceOO is %d'
								       %(iDiceOO))
							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LANUN'):
								iDiceOO += 30
								CvUtil.pyPrint('Civ is Lanun, Dice is now %d'
									       %(iDiceOO))
							if iLeader.getFavoriteReligion() == iOO:
								iDiceOO += 30
								CvUtil.pyPrint('Leader has OO as FavRel, Dice is now %d'
									       %(iDiceOO))
							#if iFlavor != 0:
							#	iDiceOO += iFlavor
							if bOOFounded:
								iDiceOO -= 50
								CvUtil.pyPrint('OO is already founded, Dice is now %d'
									       %(iDiceOO))
							if iDiceOO >= 0 \
							and iDiceOO >= 100-iLeader.getReligionWeightModifier(iOO):
								iOOValue = iDiceOO - (100-iLeader.getReligionWeightModifier(iOO))
								CvUtil.pyPrint('Dice was good, OO Value is %d'
									       %(iOOValue))
								if iOOValue > iBestValue:
									iBestValue = iOOValue
									iBestReligion = iOO
									CvUtil.pyPrint('OOValue is Best!')
								else:
									CvUtil.pyPrint('OOValue rejected!')
							else:
								CvUtil.pyPrint('OO rejected!')
						else:
							CvUtil.pyPrint('... %s has already a Holy City!'
								       %(iLeader.getDescription()))
					else:
						CvUtil.pyPrint('... rejected! (no mysticism, no sailing, not >= 3 cities, good, agnostic)')
				else:
					CvUtil.pyPrint('... rejected because leader doesn\'t like OO!')
			else:
				CvUtil.pyPrint('... no OO in this game!')
							
			## The Order
			CvUtil.pyPrint('Checking the Order eligibility...')
			if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_6):
				if iLeader.getReligionWeightModifier(iOrd) >= 0:
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PHILOSOPHY')) \
					and pPlayer.getNumCities() >= 3 \
					and not pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
						if not iHolyCity > 0 \
						or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_BANNOR') \
						or iLeader == gc.getInfoTypeForString('LEADER_SARALET'):
							CvUtil.pyPrint('%s eligible for the Order'
								       %(iLeader.getDescription()))
							iDiceOrd = CyGame().getSorenRandNum(100, "The Order")
							CvUtil.pyPrint('DiceOrd is %d'
								       %(iDiceOrd))
							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_BANNOR'):
								iDiceOrd += 30
								CvUtil.pyPrint('Civ is Bannor, Dice is now %d'
									       %(iDiceOrd))
							if iLeader.getFavoriteReligion() == iOrd:
								iDiceOrd += 30
								CvUtil.pyPrint('Leader has the Order as FavRel, Dice is now %d'
									       %(iDiceOrd))
							#if iFlavor != 0:
							#	iDiceOrd += iFlavor
							if bOrdFounded:
								iDiceOrd -= 50
								CvUtil.pyPrint('The Order is already founded, Dice is now %d'
									       %(iDiceOrd))
							if iDiceOrd >= 0 \
							and iDiceOrd >= 100-iLeader.getReligionWeightModifier(iOrd):
								iOrdValue = iDiceOrd - (100-iLeader.getReligionWeightModifier(iOrd))
								CvUtil.pyPrint('Dice was good, Order Value is %d'
									       %(iOrdValue))
								if iOrdValue > iBestValue:
									iBestValue = iOrdValue
									iBestReligion = iOrd
									CvUtil.pyPrint('OrdValue is Best!')
								else:
									CvUtil.pyPrint('OrdValue rejected!')
							else:
								CvUtil.pyPrint('The Order rejected!')
						else:
							CvUtil.pyPrint('... %s has already a Holy City!'
								       %(iLeader.getDescription()))
					else:
						CvUtil.pyPrint('... rejected! (no philosophy, not >= 3 cities, agnostic, evil)')
				else:
					CvUtil.pyPrint('... rejected because leader doesn\'t like the Order!')
			else:
				CvUtil.pyPrint('... no Order in this game!')
								
			## The AV
			CvUtil.pyPrint('Checking AV eligibility...')
			if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_0):
				if iLeader.getReligionWeightModifier(iAV) >= 0:
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PHILOSOPHY')) \
					and pPlayer.getNumCities() >= 3 \
					and not pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
						if not iHolyCity > 0 \
						or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SHEAIM') \
						or iLeader == gc.getInfoTypeForString('LEADER_MIHUATL'):
							CvUtil.pyPrint('%s eligible for AV!'
								       %(iLeader.getDescription()))
							iDiceAV = CyGame().getSorenRandNum(100, "The Veil")
							CvUtil.pyPrint('DiceAV is %d'
								       %(iDiceAV))
							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SHEAIM'):
								iDiceAV += 30
								CvUtil.pyPrint('Civ is Sheaim, Dice is now %d'
									       %(iDiceAV))
							if iLeader.getFavoriteReligion() == iAV:
								iDiceAV += 30
								CvUtil.pyPrint('Leader has AV as FavRel, Dice is now %d'
									       %(iDiceAV))
							#if iFlavor != 0:
							#	iDiceAV += iFlavor
							if bAVFounded:
								iDiceAV -= 50
								CvUtil.pyPrint('AV is already founded, Dice is now %d'
									       %(iDiceAV))
							if iDiceAV >= 0 \
							and iDiceAV >= 100-iLeader.getReligionWeightModifier(iAV):
								iAVValue = iDiceAV - (100-iLeader.getReligionWeightModifier(iAV))
								CvUtil.pyPrint('Dice was good, AV Value is %d'
									       %(iAVValue))
								if iAVValue > iBestValue:
									iBestValue = iAVValue
									iBestReligion = iAV
									CvUtil.pyPrint('AV Value is best!')
								else:
									CvUtil.pyPrint('AV Value rejected!')
							else:
								CvUtil.pyPrint('AV rejected!')
						else:
							CvUtil.pyPrint('... %s already has a holy city!'
								       %(iLeader.getDescription()))
					else:
						CvUtil.pyPrint('... rejected! (no philosophy, not >= 3 cities, good)')
				else:
					CvUtil.pyPrint('... rejected because leader does not like the AV!')
			else:
				CvUtil.pyPrint('... no AV in this game!')
			
			## The Empy
			CvUtil.pyPrint('Checking Empyrean eligibility...')
			if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_5):
				if iLeader.getReligionWeightModifier(iEmpy) >= 0:
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PHILOSOPHY')) \
					and pPlayer.getNumCities() >= 3 \
					and not pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
						if not iHolyCity > 0 \
						or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MALAKIM'):
							CvUtil.pyPrint('%s is eligible for Empy!'
								       %(iLeader.getDescription()))
							iDiceEmpy = CyGame().getSorenRandNum(100, "Empyrean")
							CvUtil.pyPrint('DiceEmpy is %d'
								       %(iDiceEmpy))
							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MALAKIM'):
								iDiceEmpy += 30
								CvUtil.pyPrint('Civ is Malakim, Dice is now %d'
									       %(iDiceEmpy))
							if iLeader.getFavoriteReligion() == iEmpy:
								iDiceEmpy += 30
								CvUtil.pyPrint('Leader has Empy as FavRel, Dice is now %d'
									       %(iDiceEmpy))
							#if iFlavor != 0:
							#	iDiceEmpy += iFlavor
							if bEmpyFounded:
								iDiceEmpy -= 50
								CvUtil.pyPrint('Empy is already founded, Dice is now %d'
									       %(iDiceEmpy))
							if iDiceEmpy >= 0 \
							and iDiceEmpy >= 100-iLeader.getReligionWeightModifier(iEmpy):
								iEmpyValue = iDiceEmpy - (100-iLeader.getReligionWeightModifier(iEmpy))
								CvUtil.pyPrint('Dice was good, Empy Value is %d'
									       %(iEmpyValue))
								if iEmpyValue > iBestValue:
									iBestValue = iEmpyValue
									iBestReligion = iEmpy
									CvUtil.pyPrint('Empy Value is best!')
								else:
									CvUtil.pyPrint('Empy Value rejected!')
							else:
								CvUtil.pyPrint('Empyrean rejected!')
						else:
							CvUtil.pyPrint('... %s already has a holy city!'
								       %(iLeader.getDescription()))
					else:
						CvUtil.pyPrint('... rejected!')
				else:
					CvUtil.pyPrint('... rejected because leader does not like Empy!')
			else:
				CvUtil.pyPrint('... no Empy in this game!')
			
			## CoE
			CvUtil.pyPrint('Checking CoE eligibility...')
			if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_2):
				if iLeader.getReligionWeightModifier(iCoE) >= 0:
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PHILOSOPHY')) \
					and pPlayer.getNumCities() >= 3 \
					and not pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
						if not iHolyCity > 0 \
						or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR'):
							CvUtil.pyPrint('%s is eligible for CoE!'
								       %(iLeader.getDescription()))
							iDiceCoE = CyGame().getSorenRandNum(100, "CoE")
							CvUtil.pyPrint('DiceCoE is %d'
								       %(iDiceCoE))
							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR'):
								iDiceCoE += 30
								CvUtil.pyPrint('Civ is Svarts, Dice is now %d'
									       %(iDiceCoE))
							if iLeader.getFavoriteReligion() == iCoE:
								iDiceCoE += 30
								CvUtil.pyPrint('Leader has CoE as FavRel, Dice is now %d'
									       %(iDiceCoE))
							#if iFlavor != 0:
							#	iDiceCoE += iFlavor
							if bCoEFounded:
								iDiceCoE -= 50
								CvUtil.pyPrint('CoE is already founded, Dice is now %d'
									       %(iDiceCoE))
							if iDiceCoE >= 0 \
							and iDiceCoE >= 100-iLeader.getReligionWeightModifier(iCoE):
								iCoEValue = iDiceCoE - (100-iLeader.getReligionWeightModifier(iCoE))
								CvUtil.pyPrint('Dice was good, CoE Value is %d'
									       %(iCoEValue))
								if iCoEValue > iBestValue:
									iBestValue = iCoEValue
									iBestReligion = iCoE
									CvUtil.pyPrint('CoE Value is best!')
								else:
									CvUtil.pyPrint('CoE Value rejected!')
							else:
								CvUtil.pyPrint('CoE rejected!')
						else:
							CvUtil.pyPrint('... %s has already a holy city!'
								       %(iLeader.getDescription()))
					else:
						CvUtil.pyPrint('... rejected!')
				else:
					CvUtil.pyPrint('... rejected because leader does not like CoE!')
			else:
				CvUtil.pyPrint('... no CoE in this game!')
				
			## Choosing the tech
			CvUtil.pyPrint('Choosing religious tech...')
			if iBestReligion != -1:
				if iBestReligion == iFoL:
					iTech = gc.getInfoTypeForString('TECH_WAY_OF_THE_FORESTS')
					CvUtil.pyPrint('... FoL chosen!')
				elif iBestReligion == iRoK:
					iTech = gc.getInfoTypeForString('TECH_WAY_OF_THE_EARTHMOTHER')
					CvUtil.pyPrint('... RoK chosen!')
				elif iBestReligion == iOO:
					iTech = gc.getInfoTypeForString('TECH_MESSAGE_FROM_THE_DEEP')
					CvUtil.pyPrint('... OO chosen!')
				elif iBestReligion == iOrd:
					iTech = gc.getInfoTypeForString('TECH_ORDERS_FROM_HEAVEN')
					CvUtil.pyPrint('... The Order chosen!')
				elif iBestReligion == iAV:
					iTech = gc.getInfoTypeForString('TECH_CORRUPTION_OF_SPIRIT')
					CvUtil.pyPrint('... AV chosen!')
				elif iBestReligion == iEmpy:
					iTech = gc.getInfoTypeForString('TECH_HONOR')
					CvUtil.pyPrint('... Empyrean chosen!')
				elif iBestReligion == iCoE:
					iTech = gc.getInfoTypeForString('TECH_DECEPTION')
					CvUtil.pyPrint('... CoE chosen!')
			else:
				CvUtil.pyPrint('... none chosen.')
		####--End Religion Beelines---###
		
		####-----###
		### Civ/Leaders beelines
		####-----###

		## Balseraphs -> Festivals
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_BALSERAPHS'):
			iTech = gc.getInfoTypeForString('TECH_FESTIVALS')
				
		## Calabim >= 3 cities -> Feudalism
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_CALABIM'):
			if pPlayer.getNumCities() >= 3:
				iTech = gc.getInfoTypeForString('TECH_FEUDALISM')
			
		## Clan of Embers -> Masonry
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_CLAN_OF_EMBERS'):
			iTech = gc.getInfoTypeForString('TECH_MASONRY')
			
		## Doviello >= 2 cities -> Mining
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_DOVIELLO') \
		and pPlayer.getNumCities() >= 2:
			iTech = gc.getInfoTypeForString('TECH_MINING')
				
		## Luchuirp >= 2 cities -> Construction
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LUCHUIRP') \
		and pPlayer.getNumCities() >= 2:
			iTech = gc.getInfoTypeForString('TECH_CONSTRUCTION')
			
		## Hippus >= 2 cities -> Horseback Riding
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_HIPPUS') \
		and pPlayer.getNumCities() >= 2:
			iTech = gc.getInfoTypeForString('TECH_HORSEBACK_RIDING')

		## Khazad -> If Mining or Ancient Chants -> Way of the Earthmother
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_KHAZAD'):
			if (eTeam.isHasTech(gc.getInfoTypeForString('TECH_ANCIENT_CHANTS')) or eTeam.isHasTech(gc.getInfoTypeForString('TECH_MINING'))):
				if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_4):
					iTech = gc.getInfoTypeForString('TECH_WAY_OF_THE_EARTHMOTHER')

		## Lanun -> Sailing
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LANUN'):
			iTech = gc.getInfoTypeForString('TECH_SAILING')

		## Ljosalfar -> If Tracking or Ancient Chants -> Way of the Forests
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR') \
		or iLeader == gc.getInfoTypeForString('LEADER_HATHEIM'):
			if (eTeam.isHasTech(gc.getInfoTypeForString('TECH_ANCIENT_CHANTS')) or eTeam.isHasTech(gc.getInfoTypeForString('TECH_TRACKING'))):
				if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_RELIGION_3):
					iTech = gc.getInfoTypeForString('TECH_WAY_OF_THE_FORESTS')
					
		## Ngomele -> If Writing -> Code of Laws
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_NGOMELE'):
			if (eTeam.isHasTech(gc.getInfoTypeForString('TECH_WRITING'))):
				iTech = gc.getInfoTypeForString('TECH_CODE_OF_LAWS')

		## If Amurites or Sheaim and if has KotE -> Sorcery
		#if eTeam.isHasTech(gc.getInfoTypeForString('TECH_KNOWLEDGE_OF_THE_ETHER')):
		#	if (pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_AMURITES') or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SHEAIM')):
		#		iTech = gc.getInfoTypeForString('TECH_SORCERY')
				
		####--End Beelines---###
		
		####-----###
		### Crucial techs
		####-----###
		
		if pPlayer.getNumCities() >= 9 and eTeam.isHasTech(gc.getInfoTypeForString('TECH_CURRENCY')) == False and eTeam.isHasTech(gc.getInfoTypeForString('TECH_CODE_OF_LAWS')):
			iTech = gc.getInfoTypeForString('TECH_CURRENCY') 
		
		
		if pPlayer.getNumCities() >= 8 and eTeam.isHasTech(gc.getInfoTypeForString('TECH_SANITATION')) == False and eTeam.isHasTech(gc.getInfoTypeForString('TECH_BRONZE_WORKING')):
			iTech = gc.getInfoTypeForString('TECH_SANITATION') 
				
		if pPlayer.getNumCities() >= 4 and eTeam.isHasTech(gc.getInfoTypeForString('TECH_BRONZE_WORKING')) == False:
			iTech = gc.getInfoTypeForString('TECH_BRONZE_WORKING')
			
		if pPlayer.getNumCities() >= 3 \
		and eTeam.isHasTech(gc.getInfoTypeForString('TECH_MYSTICISM')):
			if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_ARCANE')) \
			or pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_SUMMONER')) \
			or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SHEAIM'):
				iTech = gc.getInfoTypeForString('TECH_KNOWLEDGE_OF_THE_ETHER')
		
		if pPlayer.getNumCities() >= 4 and eTeam.isHasTech(gc.getInfoTypeForString('TECH_TRADE')) == False and eTeam.isHasTech(gc.getInfoTypeForString('TECH_WRITING')):
			iTech = gc.getInfoTypeForString('TECH_TRADE') 
		
		if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MYSTICISM'))== False: 
			iTech = gc.getInfoTypeForString('TECH_MYSTICISM')
									
		if pPlayer.getNumCities() >=2 and eTeam.isHasTech(gc.getInfoTypeForString('TECH_CALENDAR')) == True and eTeam.isHasTech(gc.getInfoTypeForString('TECH_FESTIVALS'))== False: 
			iTech = gc.getInfoTypeForString('TECH_FESTIVALS')
			
		if eTeam.isHasTech(gc.getInfoTypeForString('TECH_EXPLORATION')) == False:
			iTech = gc.getInfoTypeForString('TECH_EXPLORATION')
			
		####-----Begin checks for resources-enabling techs---###
		
		iTechHunting = gc.getInfoTypeForString('TECH_HUNTING')
		iTechCalendar = gc.getInfoTypeForString('TECH_CALENDAR')
		iTechAH = gc.getInfoTypeForString('TECH_ANIMAL_HUSBANDRY')
		iTechMasonry = gc.getInfoTypeForString('TECH_MASONRY')
		iTechMining = gc.getInfoTypeForString('TECH_MINING')
		iTechPottery = gc.getInfoTypeForString('TECH_CRAFTING')
		
		iHunting = 0
		iCalendar = 0
		iAH = 0
		iMining = 0
		iMasonry = 0
		iPottery = 0
		
		iNumCity = pPlayer.getNumCities()
		
		iBestValue = 0
		iBestTech = -1
		
		## Hunting
		if not eTeam.isHasTech(iTechHunting) \
		or not eTeam.isHasTech(iTechCalendar) \
		or not eTeam.isHasTech(iTechAH) \
		or not eTeam.isHasTech(iTechMasonry) \
		or not eTeam.isHasTech(iTechMining) \
		or not eTeam.isHasTech(iTechPottery):
			for pyCity in PyHelpers.PyPlayer(ePlayer).getCityList():
				pCity2 = pyCity.GetCy()
				iX = pCity2.getX()
				iY = pCity2.getY()
				for iiX in range(iX-2, iX+3, 1):
					for iiY in range(iY-2, iY+3, 1):
						pLoopPlot = CyMap().plot(iiX,iiY)
						eBonus = pLoopPlot.getBonusType(TeamTypes.NO_TEAM)
						eFeature = pLoopPlot.getFeatureType()
						if not pLoopPlot.isNone():
							if eBonus != BonusTypes.NO_BONUS:
								if not eTeam.isHasTech(iTechHunting):
									## Checks hunting-enabled resources
									CvUtil.pyPrint('Begins Hunting check...')
									if eBonus == gc.getInfoTypeForString('BONUS_DEER'):
										iHunting += 4
										CvUtil.pyPrint('... Deer: +4...')
									if eBonus == gc.getInfoTypeForString('BONUS_FUR'):
										iHunting += 4
										CvUtil.pyPrint('... Fur: +4...')
									if eBonus == gc.getInfoTypeForString('BONUS_IVORY'):
										iHunting += 4
										CvUtil.pyPrint('... Ivory: +4...')
									CvUtil.pyPrint('... Hunting value is %d...'
											%(iHunting))
								if not eTeam.isHasTech(iTechCalendar):
									## Checks calendar-enabled resources
									CvUtil.pyPrint('Begins Calendar check...')
									if eBonus == gc.getInfoTypeForString('BONUS_DYE'):
										iCalendar += 6
										CvUtil.pyPrint('... Dye: +6...')
									if eBonus == gc.getInfoTypeForString('BONUS_INCENSE'):
										iCalendar += 7
										CvUtil.pyPrint('... Incense: +7...')
									if eBonus == gc.getInfoTypeForString('BONUS_TEA'):
										iCalendar += 5
										CvUtil.pyPrint('... Tea: +5...')
									if eBonus == gc.getInfoTypeForString('BONUS_COFFEE'):
										iCalendar += 5
										CvUtil.pyPrint('... Coffee: +5...')
									if eBonus == gc.getInfoTypeForString('BONUS_SPICES'):
										iCalendar += 5
										CvUtil.pyPrint('... Spices: +5...')
									if eBonus == gc.getInfoTypeForString('BONUS_OLIVES'):
										iCalendar += 5
										CvUtil.pyPrint('... Olives: +5...')
									if eBonus == gc.getInfoTypeForString('BONUS_COTTON'):
										iCalendar += 4
										CvUtil.pyPrint('... Cotton: +4...')
									if eBonus == gc.getInfoTypeForString('BONUS_SUGAR'):
										iCalendar += 4
										CvUtil.pyPrint('... Sugar: +4...')
									if eBonus == gc.getInfoTypeForString('BONUS_BANANA'):
										iCalendar += 3
										CvUtil.pyPrint('... Banana: +3...')
									if eBonus == gc.getInfoTypeForString('BONUS_SILK'):
										iCalendar += 5
										CvUtil.pyPrint('... Silk: +5...')
									CvUtil.pyPrint('... Calendar value is %d...'
											   %(iCalendar))
								if not eTeam.isHasTech(iTechAH):
									## Checks animal husbandry-enabled resources
									CvUtil.pyPrint('Begins Animal Husbandry check...')
									if eBonus == gc.getInfoTypeForString('BONUS_HORSE'):
										iAH += 4
										CvUtil.pyPrint('... Horse: +4...')
									if eBonus == gc.getInfoTypeForString('BONUS_SHEEP'):
										iAH += 5
										CvUtil.pyPrint('... Sheep: +5...')
									if eBonus == gc.getInfoTypeForString('BONUS_COW'):
										iAH += 5
										CvUtil.pyPrint('... Cow: +5...')
									if eBonus == gc.getInfoTypeForString('BONUS_PIG'):
										iAH += 5
										CvUtil.pyPrint('... Pig: +5...')
									CvUtil.pyPrint('... Animal Husbandry value is %d...'
											   %(iAH))
								if not eTeam.isHasTech(iTechMining):
									## Checks mining enable resources
									CvUtil.pyPrint('Begins Mining check...')
									if eBonus == gc.getInfoTypeForString('BONUS_GOLD'):
										iMining += 9
										CvUtil.pyPrint('... Gold: +9...')
									if eBonus == gc.getInfoTypeForString('BONUS_GEMS'):
										iMining += 7
										CvUtil.pyPrint('... Gems: +7...')
									if eBonus == gc.getInfoTypeForString('BONUS_SILVER'):
										iMining += 6
										CvUtil.pyPrint('... Silver: +6...')
									if eBonus == gc.getInfoTypeForString('BONUS_MUSHROOMS'):
										iMining += 3
										CvUtil.pyPrint('... Mushrooms: +3...')
									if eBonus == gc.getInfoTypeForString('BONUS_SALT'):
										iMining += 4
										CvUtil.pyPrint('... Salt: +4...')
									if eBonus == gc.getInfoTypeForString('BONUS_AMBER'):
										iMining += 5
										CvUtil.pyPrint('... Amber: +5...') 
									CvUtil.pyPrint('... Mining value is %d...'
											   %(iMining))
								if not eTeam.isHasTech(iTechMasonry):
									## Checks masonry enabled resources
									CvUtil.pyPrint('Begins Masonry check...')
									if eBonus == gc.getInfoTypeForString('BONUS_MARBLE'):
										iMasonry += 6
										CvUtil.pyPrint('... Marble: +6...')
									if iMining > 0:
										iMasonry += iMining
										CvUtil.pyPrint('... Mining value: +%d...'
												   %(iMining))
									CvUtil.pyPrint('... Masonry value is %d...'
											   %(iMasonry))
								if not eTeam.isHasTech(iTechPottery):
									## Checks pottery enable resources
									CvUtil.pyPrint('Begins Pottery check...')
									if eBonus == gc.getInfoTypeForString('BONUS_WINE'):
										iPottery += 5
										CvUtil.pyPrint('... Wine: +5...')
									CvUtil.pyPrint('... Pottery value is %d...'
											   %(iPottery))
			if iHunting > 0 \
			and iHunting > iBestValue:
				iBestValue = iHunting
				iBestTech = iTechHunting
			if iCalendar > 0 \
			and iCalendar > iBestValue:
				iBestValue = iCalendar
				iBestTech = iTechCalendar
			if iAH > 0 \
			and iAH > iBestValue:
				iBestValue = iAH
				iBestTech = iTechAH
			if iMining > 0 \
			and iMining > iBestValue:
				iBestValue = iMining
				iBestTech = iTechMining
			if iMasonry > 0 \
			and iMasonry > iBestValue:
				iBestValue = iMasonry
				iBestTech = iTechMasonry
			if iPottery > 0 \
			and iPottery > iBestValue:
				iBestValue = iPottery
				iBestTech = iTechPottery
			if iBestTech != -1:
				iTech = iBestTech
				CvUtil.pyPrint('Tech chosen is %s!'
					       %(gc.getTechInfo(iTech).getDescription()))
		
		## Must research Agriculture
		if not eTeam.isHasTech(gc.getInfoTypeForString('TECH_AGRICULTURE')):
			iTech = gc.getInfoTypeForString('TECH_AGRICULTURE')
			
		## Check for seafood
		if pPlayer.countNumCoastalCities() ==1: 
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_FISHING')) == False :
				iX = pCity.getX()
				iY = pCity.getY()
				iseafood = 0
				for iiX in range(iX-2, iX+3, 1):
					for iiY in range(iY-2, iY+3, 1):
						pLoopPlot = CyMap().plot(iiX,iiY)
						eBonus = pLoopPlot.getBonusType(TeamTypes.NO_TEAM)
						eFeature = pLoopPlot.getFeatureType()
						if eBonus != BonusTypes.NO_BONUS:
							if not pLoopPlot.isNone():
								if eBonus == gc.getInfoTypeForString('BONUS_CLAM'):
									iseafood = iseafood +1
								if eBonus == gc.getInfoTypeForString('BONUS_CRAB') :
									iseafood = iseafood +1
								if eBonus == gc.getInfoTypeForString('BONUS_FISH') :
									iseafood = iseafood +2
								if eBonus == gc.getInfoTypeForString('BONUS_PEARL'):
									iseafood = iseafood +1
						if eFeature != -1:
							if not pLoopPlot.isNone():
								if eFeature == gc.getInfoTypeForString('FEATURE_KELP'):
									iseafood = iseafood +1
				if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LANUN'):
					iseafood = iseafood +2
				if	iseafood >= 2 :		
					iTech = gc.getInfoTypeForString('TECH_FISHING')
			
		####--End Crucials---###

		if iTech != -1:
			if eTeam.isHasTech(iTech) == False:
				CvUtil.pyPrint('Final tech chosen is %s'
					       %(gc.getTechInfo(iTech).getDescription()))
				return iTech

		return TechTypes.NO_TECH

	def AI_chooseProduction(self,argsList):
		pCity = argsList[0]
		return False

	def AI_unitUpdate(self,argsList):
		pUnit = argsList[0]
		pPlot = pUnit.plot()

		if pUnit.getUnitClassType() == gc.getInfoTypeForString('UNITCLASS_GIANT_SPIDER'):
			iX = pUnit.getX()
			iY = pUnit.getY()
			for iiX in range(iX-1, iX+2, 1):
				for iiY in range(iY-1, iY+2, 1):
					pLoopPlot = CyMap().plot(iiX,iiY)
					for i in range(pLoopPlot.getNumUnits()):
						if pLoopPlot.getUnit(i).getOwner() != pUnit.getOwner():
							return 0
			return 1

		if pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_ACHERON'):
			if pPlot.isVisibleEnemyUnit(pUnit.getOwner()):
				pUnit.cast(gc.getInfoTypeForString('SPELL_BREATH_FIRE'))

		if not isLimitedUnitClass(pUnit.getUnitClassType()):
			iImprovement = pPlot.getImprovementType()
			if iImprovement != -1:
				if (iImprovement == gc.getInfoTypeForString('IMPROVEMENT_BARROW') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_HELLFIRE') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_HAUNTED_RUINS')):
					if (pUnit.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_DEMON')):
						if pPlot.getNumUnits() == 1:
							return 1
				if (iImprovement == gc.getInfoTypeForString('IMPROVEMENT_RUINS') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_HILLGIANT_STEADING') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_TROLL_CAVE')):
					if (pUnit.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ORC')):
						if pPlot.getNumUnits() == 1:
							return 1
				if (iImprovement == gc.getInfoTypeForString('IMPROVEMENT_BEAR_DEN') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_LION_DEN') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_DEN_WOLF') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_DEN_GORILLA') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_DEN_TIGER') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_GRIFFIN_NEST') or iImprovement == gc.getInfoTypeForString('IMPROVEMENT_DEN_SPIDER')):
					if (pUnit.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ANIMAL')):
						if pPlot.getNumAnimalUnits() == 1:
							return 1
				if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_GOBLIN_FORT'):
					if (pUnit.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ORC')):
						if pPlot.getNumUnits() <= 3:
							return 1

		return False

	def AI_doWar(self,argsList):
		eTeam = argsList[0]
		return False

	def AI_doDiplo(self,argsList):
		ePlayer = argsList[0]
		return False

	def calculateScore(self,argsList):
		ePlayer = argsList[0]
		bFinal = argsList[1]
		bVictory = argsList[2]
		
		iPopulationScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getPopScore(), gc.getGame().getInitPopulation(), gc.getGame().getMaxPopulation(), gc.getDefineINT("SCORE_POPULATION_FACTOR"), True, bFinal, bVictory)
		iLandScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getLandScore(), gc.getGame().getInitLand(), gc.getGame().getMaxLand(), gc.getDefineINT("SCORE_LAND_FACTOR"), True, bFinal, bVictory)
		iTechScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getTechScore(), gc.getGame().getInitTech(), gc.getGame().getMaxTech(), gc.getDefineINT("SCORE_TECH_FACTOR"), True, bFinal, bVictory)
		iWondersScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getWondersScore(), gc.getGame().getInitWonders(), gc.getGame().getMaxWonders(), gc.getDefineINT("SCORE_WONDER_FACTOR"), False, bFinal, bVictory)
		return int(iPopulationScore + iLandScore + iWondersScore + iTechScore)

	def doHolyCity(self):
		return False

	def doHolyCityTech(self,argsList):
		eTeam = argsList[0]
		ePlayer = argsList[1]
		eTech = argsList[2]
		bFirst = argsList[3]
		return False

	def doGold(self,argsList):
		ePlayer = argsList[0]
		return False

	def doResearch(self,argsList):
		ePlayer = argsList[0]
		return False

	def doGoody(self,argsList):
		ePlayer = argsList[0]
		pPlot = argsList[1]
		pUnit = argsList[2]
		return False

	def doGrowth(self,argsList):
		pCity = argsList[0]
		return False

	def doProduction(self,argsList):
		pCity = argsList[0]
		return False

	def doCulture(self,argsList):
		pCity = argsList[0]
		return False

	def doPlotCulture(self,argsList):
		pCity = argsList[0]
		bUpdate = argsList[1]
		ePlayer = argsList[2]
		iCultureRate = argsList[3]
		return False

	def doReligion(self,argsList):
		pCity = argsList[0]
		return False

	def cannotSpreadReligion(self,argsList):
		iOwner, iUnitID, iReligion, iX, iY = argsList[0]
		return False

	def doGreatPeople(self,argsList):
		pCity = argsList[0]
		return False

	def doMeltdown(self,argsList):
		pCity = argsList[0]
		return False
	
	def doReviveActivePlayer(self,argsList):
		"allows you to perform an action after an AIAutoPlay"
		iPlayer = argsList[0]
		return False
	
	def doPillageGold(self, argsList):
		"controls the gold result of pillaging"
		pPlot = argsList[0]
		pUnit = argsList[1]
		
		iPillageGold = 0
		iPillageGold = CyGame().getSorenRandNum(gc.getImprovementInfo(pPlot.getImprovementType()).getPillageGold(), "Pillage Gold 1")
		iPillageGold += CyGame().getSorenRandNum(gc.getImprovementInfo(pPlot.getImprovementType()).getPillageGold(), "Pillage Gold 2")

		iPillageGold += (pUnit.getPillageChange() * iPillageGold) / 100
		
		return iPillageGold
	
	def doCityCaptureGold(self, argsList):
		"controls the gold result of capturing a city"
		
		pOldCity = argsList[0]
		
		iCaptureGold = 0
		
		iCaptureGold += gc.getDefineINT("BASE_CAPTURE_GOLD")
		iCaptureGold += (pOldCity.getPopulation() * gc.getDefineINT("CAPTURE_GOLD_PER_POPULATION"))
		iCaptureGold += CyGame().getSorenRandNum(gc.getDefineINT("CAPTURE_GOLD_RAND1"), "Capture Gold 1")
		iCaptureGold += CyGame().getSorenRandNum(gc.getDefineINT("CAPTURE_GOLD_RAND2"), "Capture Gold 2")

		if (gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS") > 0):
			iCaptureGold *= cyIntRange((CyGame().getGameTurn() - pOldCity.getGameTurnAcquired()), 0, gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS"))
			iCaptureGold /= gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS")
		
		return iCaptureGold
	
	def citiesDestroyFeatures(self,argsList):
		iX, iY= argsList
		return True
		
	def canFoundCitiesOnWater(self,argsList):
		iX, iY= argsList
		return False
		
	def doCombat(self,argsList):
		pSelectionGroup, pDestPlot = argsList
		return False

	def getConscriptUnitType(self, argsList):
		iPlayer = argsList[0]
		iConscriptUnitType = -1 #return this with the value of the UNIT TYPE you want to be conscripted, -1 uses default system
		
		return iConscriptUnitType

	def getCityFoundValue(self, argsList):
		iPlayer, iPlotX, iPlotY = argsList
		iFoundValue = -1 # Any value besides -1 will be used
		
		return iFoundValue
		
	def canPickPlot(self, argsList):
		pPlot = argsList[0]
		return true
		
	def getUnitCostMod(self, argsList):
		iPlayer, iUnit = argsList
		iCostMod = -1 # Any value > 0 will be used
		
		return iCostMod

	def getBuildingCostMod(self, argsList):
		iPlayer, iCityID, iBuilding = argsList
		pPlayer = gc.getPlayer(iPlayer)
		pCity = pPlayer.getCity(iCityID)

		iCostMod = -1 # Any value > 0 will be used

		if iBuilding == gc.getInfoTypeForString('BUILDING_GAMBLING_HOUSE'):
			if pPlayer.isGamblingRing():
				iCostMod = gc.getBuildingInfo(iBuilding).getProductionCost() / 4
		
		return iCostMod
		
	def canUpgradeAnywhere(self, argsList):
		pUnit = argsList
		
		bCanUpgradeAnywhere = 0
		
		return bCanUpgradeAnywhere
		
	def getWidgetHelp(self, argsList):
		eWidgetType, iData1, iData2, bOption = argsList
		
		return u""
		
	def getUpgradePriceOverride(self, argsList):
		iPlayer, iUnitID, iUnitTypeUpgrade = argsList
		
		return -1	# Any value 0 or above will be used
	
	def getExperienceNeeded(self, argsList):
		# use this function to set how much experience a unit needs
		iLevel, iOwner = argsList
		
		iExperienceNeeded = 0

		# regular epic game experience		
		iExperienceNeeded = iLevel * iLevel + 1

		iModifier = gc.getPlayer(iOwner).getLevelExperienceModifier()
		if (0 != iModifier):
			iExperienceNeeded += (iExperienceNeeded * iModifier + 99) / 100   # ROUND UP
			
		return iExperienceNeeded
